/**
 * output package name
 */
package com.kingdee.eas.minghua.contract.client;

import java.awt.event.*;
import java.util.Calendar;
import java.util.Date;

import org.apache.log4j.Logger;

import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.basedata.master.cssp.CustomerInfo;
import com.kingdee.eas.framework.*;

/**
 * output class name
 */
public class SupplementaryFilterUI extends AbstractSupplementaryFilterUI
{
    private static final Logger logger = CoreUIObject.getLogger(SupplementaryFilterUI.class);
    
    /**
     * output class constructor
     */
    public SupplementaryFilterUI() throws Exception
    {
        super();
        this.kDDatePicker1.setValue(new Date());
    }
    public FilterInfo getFilterInfo(){
    	FilterInfo filter=new FilterInfo();
    	if(kDTextField2.getText()!=null&&!"".equals(kDTextField2.getText())){
    		filter.getFilterItems().add(new FilterItemInfo("zcbhtname","%"+kDTextField2.getText()+"%",CompareType.LIKE));
    	}
    	if(kDTextField3.getText()!=null &&!"".equals(kDTextField3.getText())){
    		filter.getFilterItems().add(new FilterItemInfo("htNumber",kDTextField3.getText(),CompareType.EQUALS));
    	}
    	CustomerInfo customer=(CustomerInfo)kDBizPromptBox1.getValue();
    	if(customer!=null){
    			filter.getFilterItems().add(new FilterItemInfo("Agreementunit.name",customer.getName(),CompareType.EQUALS));
    	}
    	if (kDDatePicker1.getValue()!= null){		
			Calendar calendar1 = Calendar.getInstance();
			calendar1.setTime((Date)kDDatePicker1.getValue());
			calendar1.add(Calendar.DATE, -1);
			calendar1.set(calendar1.get(Calendar.YEAR), calendar1.get(Calendar.MONTH), calendar1.get(Calendar.DATE),23, 59, 59);
			filter.getFilterItems().add(new FilterItemInfo("bizDate",calendar1.getTime(),CompareType.GREATER_EQUALS));
         }
		if (kDDatePicker2.getValue()!= null){
			Calendar calendar2 = Calendar.getInstance();
			calendar2.setTime((Date)kDDatePicker2.getValue());
//			calendar2.add(Calendar.DATE, 1);
			calendar2.set(calendar2.get(Calendar.YEAR), calendar2.get(Calendar.MONTH), calendar2.get(Calendar.DATE),23, 59, 59);
			filter.getFilterItems().add(new FilterItemInfo("bizDate",calendar2.getTime(),CompareType.LESS_EQUALS));
		}
//		if(kDCheckBox1.isSelected()){
//			filter.getFilterItems().add(new FilterItemInfo("yesUp","1"));
//		}
//		if(kDCheckBox2.isSelected()){
//			filter.getFilterItems().add(new FilterItemInfo("down","1"));
//		}
//		if(kDCheckBox3.isSelected()){
//			filter.getFilterItems().add(new FilterItemInfo("xZ","1"));
//		}
    	return filter;
    }
	/**
     * output storeFields method
     */
    public void storeFields()
    {
        super.storeFields();
    }

}